import router from './router/index'
import store from './store/index'
import

router.beforeEach( async (to, from, next) => {
    if (to.path === '/login') {
        next()
    } else {
        if (localStorage.getItem('TOKEN')) {
            if (store.state.userInfo.userId === undefined) {
               await store.dispatch('updateUserInfo') 
            }
            next()
        } else {
            next('./login')
        }
    }
})